using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class manage_Default2 : System.Web.UI.Page
{
    protected Account acc;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void txtOldPassCustomValidate_ServerValidate(object source, ServerValidateEventArgs args)
    {
        acc = new Account();
        acc.username = Session["UserName"].ToString();
        acc.password = txtOldPass.Text;
        if (acc.Check_account() && txtPass.Text != "")
        {
            args.IsValid = true;
        }
        else
        {
            args.IsValid = false;
        }
    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            acc = new Account();
            acc.userid = Convert.ToInt32(Session["ID"].ToString());
            acc.password = txtPass.Text;
            acc.update_password();
            Response.Redirect("Default.aspx");
        }
    }
}
